using System;

namespace UserManagementService;

/// <summary>
/// 用户管理服务配置选项
/// </summary>
public class UserManagementOptions
{
    /// <summary>
    /// 是否启用组织管理
    /// </summary>
    public bool EnableOrganizationManagement { get; set; } = true;

    /// <summary>
    /// 是否启用自定义权限
    /// </summary>
    public bool EnableCustomPermissions { get; set; } = true;

    /// <summary>
    /// 是否启用用户导入导出
    /// </summary>
    public bool EnableUserImportExport { get; set; } = true;

    /// <summary>
    /// 是否启用用户模拟
    /// </summary>
    public bool EnableUserImpersonation { get; set; } = true;

    /// <summary>
    /// 最大用户数量限制
    /// </summary>
    public int MaxUserCount { get; set; } = 10000;

    /// <summary>
    /// 最大组织层级深度
    /// </summary>
    public int MaxOrganizationDepth { get; set; } = 10;

    /// <summary>
    /// 密码策略配置
    /// </summary>
    public PasswordPolicyOptions PasswordPolicy { get; set; } = new();

    /// <summary>
    /// 用户名策略配置
    /// </summary>
    public UsernamePolicyOptions UsernamePolicy { get; set; } = new();
}

/// <summary>
/// 密码策略选项
/// </summary>
public class PasswordPolicyOptions
{
    /// <summary>
    /// 最小长度
    /// </summary>
    public int MinLength { get; set; } = 8;

    /// <summary>
    /// 是否需要数字
    /// </summary>
    public bool RequireDigit { get; set; } = true;

    /// <summary>
    /// 是否需要小写字母
    /// </summary>
    public bool RequireLowercase { get; set; } = true;

    /// <summary>
    /// 是否需要大写字母
    /// </summary>
    public bool RequireUppercase { get; set; } = true;

    /// <summary>
    /// 是否需要特殊字符
    /// </summary>
    public bool RequireNonAlphanumeric { get; set; } = true;

    /// <summary>
    /// 密码历史记录数量
    /// </summary>
    public int PasswordHistoryCount { get; set; } = 5;
}

/// <summary>
/// 用户名策略选项
/// </summary>
public class UsernamePolicyOptions
{
    /// <summary>
    /// 最小长度
    /// </summary>
    public int MinLength { get; set; } = 3;

    /// <summary>
    /// 最大长度
    /// </summary>
    public int MaxLength { get; set; } = 50;

    /// <summary>
    /// 是否允许邮箱作为用户名
    /// </summary>
    public bool AllowEmailAsUsername { get; set; } = true;

    /// <summary>
    /// 是否允许手机号作为用户名
    /// </summary>
    public bool AllowPhoneAsUsername { get; set; } = true;
}